package com.zz.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.zz.inventory.domain.Labs;
import com.zz.inventory.domain.StudentExamRecords;
import com.zz.inventory.mapper.StudentExamRecordsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zz.inventory.mapper.ExamsMapper;
import com.zz.inventory.domain.Exams;
import com.zz.inventory.service.IExamsService;

/**
 * 考试练习任务Service业务层处理
 * 
 * @author zz
 * @date 2025-07-01
 */
@Service
public class ExamsServiceImpl implements IExamsService 
{
    @Autowired
    private ExamsMapper examsMapper;
    @Autowired
    private StudentExamRecordsMapper examRecordsMapper;

    /**
     * 查询考试练习任务
     * 
     * @param examId 考试练习任务主键
     * @return 考试练习任务
     */
    @Override
    public Exams selectExamsByExamId(Long examId)
    {
        return examsMapper.selectExamsByExamId(examId);
    }

    /**
     * 查询考试练习任务列表
     * 
     * @param exams 考试练习任务
     * @return 考试练习任务
     */
    @Override
    public List<Exams> selectExamsList(Exams exams)
    {
        return examsMapper.selectExamsList(exams);
    }

    /**
     * 新增考试练习任务
     * 
     * @param exams 考试练习任务
     * @return 结果
     */
    @Override
    public int insertExams(Exams exams)
    {
        exams.setCreateTime(DateUtils.getNowDate());
        return examsMapper.insertExams(exams);
    }
    @Override
    public int checkLabIdExists(Integer labId) {
        return examsMapper.checkLabIdExists(labId);
    }

    @Override
    public int checkSchoolIdExists(Integer schoolsId) {
        return examsMapper.checkSchoolIdExists(schoolsId);
    }


    /**
     * 修改考试练习任务
     * 
     * @param exams 考试练习任务
     * @return 结果
     */
    @Override
    public int updateExams(Exams exams)
    {
        return examsMapper.updateExams(exams);
    }

    /**
     * 批量删除考试练习任务
     * 
     * @param examIds 需要删除的考试练习任务主键
     * @return 结果
     */
    @Override
    public int deleteExamsByExamIds(Long[] examIds)
    {
        return examsMapper.deleteExamsByExamIds(examIds);
    }

    /**
     * 删除考试练习任务信息
     * 
     * @param examId 考试练习任务主键
     * @return 结果
     */
    @Override
    public int deleteExamsByExamId(Long examId)
    {
        return examsMapper.deleteExamsByExamId(examId);
    }

    @Override
    public List<StudentExamRecords> getExamRecordsByStudentId(Long studentId) {
        return examRecordsMapper.selectByStudentId(studentId);
    }

}
